package com.css.dzj.zfjg.modules.feedback.mapper;


import com.css.dzj.zfjg.modules.feedback.entity.JgLhjgDffkEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 联合监管答复
 */
public interface JgLhjgDffkMapper  extends JpaRepository<JgLhjgDffkEntity, String>, JpaSpecificationExecutor<JgLhjgDffkEntity>,
        QuerydslPredicateExecutor<JgLhjgDffkEntity> {

    /**
     * 查询监管答复信息(按照时间的降序下载)
     * nativeQuery = true:标志着为sql语句
     * @return
     */
    @Query(value = "select n.Union_Deptnamo 答复部门编号,n.Fk_Idea 反馈意见,n.Fk_Info 反馈具体信息, \n" +
            "n.Fk_Type 反馈类型,n.Fk_Union_Type 反馈单位类型, n.Supervise_Item_Code 监管事务类型 \n"+
            "from DZJZFJG.JG_LHJG_DFFK n \n" +
            "order by n.Fk_Time DESC",nativeQuery = true)
    public List<Map> getAll();

    @Query(value = "select count(Uuid) from JG_LHJG_DFFK where Task_No = :taskNo",
            nativeQuery = true)
    String getFkCountByTaskNo(@Param("taskNo") String taskNo);

}
